home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / RESOURCES / KOOB / common / ui / SaveFileDlg.gui < prev    next >
Encoding:
Text File  |  2005-11-23  |  7.3 KB  |  246 lines

  1. //--- OBJECT WRITE BEGIN ---
  2. new GuiControl(SaveFileDlgEx) {
  3.    profile = "GuiDialogProfile";
  4.    horizSizing = "right";
  5.    vertSizing = "bottom";
  6.    fitParentWidth = "0";
  7.    fitParentHeight = "0";
  8.    position = "0 0";
  9.    extent = "800 600";
  10.    minExtent = "8 8";
  11.    visible = "1";
  12.       helpTag = "0";
  13.  
  14.    new GuiWindowCtrl() {
  15.       profile = "GuiWindowProfile";
  16.       horizSizing = "center";
  17.       vertSizing = "center";
  18.       fitParentWidth = "0";
  19.       fitParentHeight = "0";
  20.       position = "73 61";
  21.       extent = "653 478";
  22.       minExtent = "8 8";
  23.       visible = "1";
  24.       text = "Save File...";
  25.       maxLength = "255";
  26.       resizeWidth = "1";
  27.       resizeHeight = "1";
  28.       canMove = "1";
  29.       canClose = "1";
  30.       canMinimize = "1";
  31.       canMaximize = "1";
  32.       MinSize = "50 50";
  33.       closeCommand = "Canvas.popDialog(SaveFileDlgEx);";
  34.          helpTag = "0";
  35.     
  36.       new GuiButtonCtrl() {
  37.          profile = "GuiButtonProfile";
  38.          horizSizing = "left";
  39.          vertSizing = "top";
  40.          fitParentWidth = "0";
  41.          fitParentHeight = "0";
  42.          position = "513 449";
  43.          extent = "60 20";
  44.          minExtent = "8 8";
  45.          visible = "1";
  46.          command = "DoSaveFileExCallback();";
  47.          text = "Save";
  48.          groupNum = "-1";
  49.          buttonType = "PushButton";
  50.             helpTag = "0";
  51.       };
  52.       new GuiButtonCtrl() {
  53.          profile = "GuiButtonProfile";
  54.          horizSizing = "left";
  55.          vertSizing = "top";
  56.          fitParentWidth = "0";
  57.          fitParentHeight = "0";
  58.          position = "583 449";
  59.          extent = "60 20";
  60.          minExtent = "8 8";
  61.          visible = "1";
  62.          command = "Canvas.popDialog(SaveFileDlgEx);";
  63.          text = "Cancel";
  64.          groupNum = "-1";
  65.          buttonType = "PushButton";
  66.             helpTag = "0";
  67.       };
  68.       new GuiTextCtrl() {
  69.          profile = "GuiTextProfile";
  70.          horizSizing = "right";
  71.          vertSizing = "top";
  72.          position = "10 449";
  73.          extent = "89 18";
  74.          minExtent = "8 2";
  75.          visible = "1";
  76.          text = "File name:";
  77.          maxLength = "255";
  78.       };
  79.       new GuiTextEditCtrl(SaveFileExEdit) {
  80.          profile = "GuiTextEditProfile";
  81.          horizSizing = "right";
  82.          vertSizing = "top";
  83.          position = "60 449";
  84.          extent = "286 16";
  85.          minExtent = "8 8";
  86.          visible = "1";
  87.          helpTag = "0";
  88.          maxLength = "255";
  89.          historySize = "0";
  90.          password = "0";
  91.          tabComplete = "0";
  92.        };
  93.       
  94.       new GuiFrameSetCtrl() {
  95.          profile = "GuiDefaultProfile";
  96.          horizSizing = "width";
  97.          vertSizing = "height";
  98.          fitParentWidth = "0";
  99.          fitParentHeight = "0";
  100.          position = "4 24";
  101.          extent = "643 416";
  102.          minExtent = "8 2";
  103.          visible = "1";
  104.          columns = "0 245";
  105.          rows = "0";
  106.          borderWidth = "7";
  107.          borderColor = "206 206 206 206";
  108.          borderEnable = "dynamic";
  109.          borderMovable = "dynamic";
  110.          autoBalance = "0";
  111.          fudgeFactor = "0";
  112.       
  113.          new GuiScrollCtrl() {
  114.             profile = "GuiScrollProfile";
  115.             horizSizing = "right";
  116.             vertSizing = "bottom";
  117.             fitParentWidth = "0";
  118.             fitParentHeight = "1";
  119.             position = "0 0";
  120.             extent = "238 416";
  121.             minExtent = "8 2";
  122.             visible = "1";
  123.             willFirstRespond = "1";
  124.             hScrollBar = "dynamic";
  125.             vScrollBar = "dynamic";
  126.             constantThumbHeight = "0";
  127.             childMargin = "0 0";
  128.             
  129.             new GuiDirectoryTreeCtrl(SaveDirTreeEx) {
  130.                profile = "GuiDirectoryTreeProfile";
  131.                horizSizing = "right";
  132.                vertSizing = "bottom";
  133.                fitParentWidth = "0";
  134.                fitParentHeight = "0";
  135.                position = "2 -670";
  136.                extent = "206 1470";
  137.                minExtent = "8 2";
  138.                visible = "1";
  139.                tabSize = "16";
  140.                textOffset = "2";
  141.                fullRowSelect = "0";
  142.                itemHeight = "21";
  143.                destroyTreeOnSleep = "0";
  144.                MouseDragging = "0";
  145.                MultipleSelections = "0";
  146.             };
  147.          };
  148.          
  149.          new GuiScrollCtrl() {
  150.             profile = "GuiScrollProfile";
  151.             horizSizing = "right";
  152.             vertSizing = "bottom";
  153.             fitParentWidth = "1";
  154.             fitParentHeight = "1";
  155.             position = "245 0";
  156.             extent = "643 416";
  157.             minExtent = "8 2";
  158.             visible = "1";
  159.             willFirstRespond = "1";
  160.             hScrollBar = "alwaysOn";
  161.             vScrollBar = "alwaysOn";
  162.             constantThumbHeight = "0";
  163.             childMargin = "0 0";
  164.             
  165.             new GuiDirectoryFileListCtrl(SaveFileListEx) {
  166.                profile = "GuiDirectoryFileListProfile";
  167.                horizSizing = "right";
  168.                vertSizing = "bottom";
  169.                fitParentWidth = "0";
  170.                fitParentHeight = "0";
  171.                position = "2 2";
  172.                extent = "621 224";
  173.                minExtent = "8 2";
  174.                visible = "1";
  175.                enumerate = "0";
  176.                resizeCell = "1";
  177.                columns = "0";
  178.                fitParentWidth = "1";
  179.                clipColumnText = "0";
  180.             };
  181.          };
  182.       };
  183.    };
  184. };
  185. //--- OBJECT WRITE END ---
  186.  
  187.  
  188. //------------------------------------------------------------------------------
  189. // ex: getSaveFilenameEx("~/stuff/*.*", saveStuff);
  190. //     -- calls 'saveStuff(%filename)' on ok
  191. //------------------------------------------------------------------------------
  192. function getSaveFilename(%filespec, %callback, %currentFile)
  193. {
  194.   $GuiSaveDialogCallback = %callback;   
  195.   if( %filespec $= "" )
  196.    $SaveFileExFileSpec = "*.*";
  197.   else
  198.    $SaveFileExFileSpec = %filespec;
  199.  
  200.   Canvas.pushDialog(SaveFileDlgEx, 99);
  201.  
  202.   $SaveFileExFile = %currentFile;
  203.  
  204.    // If we have a current path, set the tree to it
  205.    if( filePath( %currentFile ) !$= "" )
  206.       SaveDirTreeEx.setSelectedPath( filePath( %currentFile ) );
  207.    else if ( $pref::Constructor::lastPath !$= "" )
  208.       SaveDirTreeEx.setSelectedPath( $pref::Constructor::lastPath );
  209.       
  210.    // Update our file view to reflect the changes
  211.    SaveFileListEx.setPath( SaveDirTreeEx.getSelectedPath(), $SaveFileExFileSpec );
  212.  
  213.    // Update the file edit control
  214.    SaveFileExEdit.setText(fileName($SaveFileExFile));
  215. }
  216.  
  217.  
  218. //--------------------------------------
  219. function DoSaveFileExCallback()
  220. {
  221.   %path = SaveDirTreeEx.getSelectedPath();
  222.   %file = SaveFileExEdit.getValue();
  223.   %cat = %path @ "/" @ %file;
  224.   
  225.   // MEOW
  226.   echo(%cat);
  227.     
  228.   eval( $GuiSaveDialogCallback @ "(\"" @ %cat @"\");" );
  229.  
  230.   Canvas.popDialog(SaveFileDlgEx);
  231. }   
  232.  
  233. function SaveDirTreeEx::onSelectPath( %this, %path )
  234. {
  235.    // Update our file view to reflect the changes
  236.    SaveFileListEx.setPath( %path, $SaveFileExFileSpec  );
  237.    
  238.    $pref::Constructor::lastPath = %path;
  239. }
  240.  
  241. function SaveFileListEx::onSelect( %this, %listid, %file )
  242. {
  243.    // Update our file name to the one selected
  244.    SaveFileExEdit.setText( %file );
  245. }
  246.